Method for reducing blocking artifacts

ABSTRACT

A method for removing blocking artifacts from moving and still pictures, comprising classifying horizontal and vertical boundaries in each picture as blocky or non-blocky; for each blocky boundary, defining an adaptive, picture content-dependent, one-dimensional filtered pixels region of interest (ROI) that crosses the boundary and is bound at each of its ends by a bounding pixel; defining a finite filter having a length correlated with the length of the ROI; defining a filtering pixels expansion that uniquely determines the padding values of the finite length filtered pixels ROI for the finite length filtering; and filtering the ROI pixels using the finite filter and the filtering expansion.

CROSS-REFERENCE TO RELATED APPLICATIONS

This application is entitled to the benefit of priority from U.S. Provisional Application No. 60/316,963 filed Sep. 5, 2001.

FIELD AND BACKGROUND OF THE INVENTION

The present invention relates to a method for reducing blocking artifacts. The invention is useful for removing blocking artifacts from still pictures or moving pictures that were reconstructed according to any coding scheme that introduce blocking artifacts. The invention provides a robust and picture-content dependent solution for removing the blocking artifact without reducing the quality or sharpness of the processed picture, and may be implemented efficiently in software and in hardware.

In Block-Based video coding (such as the ISO standards MPEG1, MPEG2, MPEG4 and JPEG, and ITU standards H.261 and H.263) each picture in the video sequence is partitioned into blocks of N×N pixels, (specifically 8×8 pixels in the MPEG/JPEG compression family and in H.263/H.261), and each block is then coded independently. When the bits-budget for the encoding is limited, a single block may be assigned with fewer bits than required for its representation (“lossy compression”). Since most popular block-based techniques are Discrete Cosine Transform (DCT) based, it is common that the deprived data is the data related to higher spatial frequency. In the extreme case of Very Low Bit rate (VLB) coding, most of the bits are allocated to the mean pixel value of the block, and only a few are allocated to the higher frequency variations. As a result, the continuity between adjacent blocks is broken. This discontinuity at the block boundaries presents an annoying artifact known as the Blocking Artifact. FIG. 1 illustrates the blocking problem: (A)—an original picture, and (B) a reconstructed (encoded/decoded) picture. The picture in (B) clearly shows the blocking artifact.

Existing methods to reduce this blocking artifact, as described for example in “Method of Removing Blocking Artifacts in a Coding System of a Moving Picture”, U.S. Pat. No. 6,240,135 to Kim et. al., (hereinafter “Kim '135”) is unsatisfactory. Other, equally unsatisfactory prior art methods dealing with the subject include ITU H.263 recommendation Annex J: Deblocking filter mode, U.S. Pat. No. 6,028,967, to Kim, U.S. Pat. No. 6,188,799 to Tan, U.S. Pat. No. 6,151,420 to Wober, U.S. Pat. No. 6,236,764 to Zhou, U.S. Pat. No. 6,215,425 to Andrews, U.S. Pat. No. 5,67,736 to Suzuki, U.S. Pat. No. 5,933,541 to Kutka, and U.S. Pat. No. 5,802,218 to Brailean. The Kim '135 patent, assigned to LG Electronics Inc. (hereinafter “the LG method”) is the most relevant to this disclosure, and is discussed in more detail below.

Kim '135 considers 5 pixels from each side of a block boundary. An absolute difference is then calculated between each two neighbors (9 pairs). If the absolute difference is larger than a threshold, a “0” is accumulated to a counter, while if it is smaller than the same threshold, a “1” is accumulated to the counter. The outcome is a number between 0 and 9. This is in effect a kind of an “inverse activity” measure over the boundary and into the depth of the block on each side. This inverse activity type of measure serves to decide between two methods (“modes”) of processing:

-   -   I. a Default mode (that will in effect change only the 2         boundary pixels), which is operative when the “inverse activity”         is small (e.g. in case of textured data).     -   II. a DC mode, which is operative when the “inverse activity” is         large (the area is more or less smooth, with maybe one edge         inside it). In the DC mode there are two options: 1) if the         difference between the minimal pixel and the maximal pixel in         the region of 4 pixels to the left of the boundary and 4 pixels         to the right is large (larger or equal to twice the quantization         scale (QS) factor of the treated block) then nothing is done         (since the algorithm deduces that the blocking artifact is not         severe). However, this may be also the case when the blocking         artifact is severe and there is also an edge in the 8 pixels         region, so that this lack of action is actually a         disadvantage. 2) if the difference is small (smaller than twice         the QS factor of the treated block) then the entire region of         interest (ROI) of the eight pixels is smoothed with a constant         filter (since the algorithm deduces that the blocking artifact         is severe).

The disadvantages of the LG method become clear when considering the following examples. In the first example (Case “A”), consider a block with a visible and solid block boundary, having a large single high edge within the block (a very common case in natural pictures divided to 8×8 blocks). In such a case, the LG method chooses the DC mode (II). Within the DC mode option 1 is chosen and no filtering is performed, i.e. the LG method will not filter the visible block boundary of this block. In another, similar example (Case “B”), consider a block in which the edge is not too high, i.e. it is a mild edge. In this case the LG method will also choose the DC mode, but in this case option 2 is chosen and filtering is performed. That is, the LG method will filter the visible block boundary of this block, but will also filter a real edge (that will affect its neighborhood since the LG method use a 9 taps filter in this case).

In a second example (Case “C”), consider a block with a visible and solid block boundary and two edges (one on each side of the boundary). In this case, the LG method will choose the Default mode (I). In the default mode, the LG method will change the value of the 2 pixels that cross the block boundary. The problem here is that the LG method is not exploiting the possibility to smooth deeper into the block, even if the edges are far away from the boundary (say at ±3 pixels from the boundary).

Yet another fault of the LG algorithm (as disclosed in the LG method) is that it is not robust to changes in the threshold against which the absolute differences are evaluated. There are no numerical values for the threshold in the prior art LG patent above (Kim '135), and the examples used above assumed the most logical values, taken from the MPEG4 standard in which the LG algorithm is presented with numerical values. If the threshold is changed to a smaller number, then Case “A” above becomes frequent, and the algorithm will produce poor results. If the threshold is changed to a larger number, then the DC mode (II) becomes irrelevant (it will not be activated). Therefore, the LG method is not robust.

There is thus a widely recognized need for, and it would be highly advantageous to have, a low cost implementation, general use, accurate de-blocking filter aimed at reducing the blocking artifact.

SUMMARY OF THE INVENTION

The present invention is of a method for reducing blocking artifacts. The method presented herein can remove blocking artifacts from pictures that were, for example, compressed using one of the compression methods mentioned above. A major advantage of the method disclosed herein is an adaptive choice of a filtered pixels region of interest (ROI). The population of pixels that undergo filtering is adaptively chosen as an integral part of the invention. The adaptation is defined in a way such that edges in the content of the picture are not smoothed out by the method, which, in essence, is a low pass filtering method due to the nature of the problem it solves. The method uniquely treats bounding conditions for finite length filtering so that no artifacts are introduced by it. It also detects areas in the picture content that are smooth, and uses an aggressive filter for better smoothing of blocking artifacts in such areas. As a result, the quality and sharpness of the picture are not reduced by applying this method to blocky pictures.

The method presented herein can be performed on a reconstructed picture, used as a post-processing operation in order to improve and enhance picture quality, or used as an in-loop operation in order to enhance image quality and improve the process of estimating motion within the compression loop.

According to the present invention there is provided a method for removing blocking artifacts from moving and still pictures, each picture composed of blocks defined by horizontal and vertical block boundaries, the method comprising the steps of: in each picture, classifying the horizontal and vertical boundaries as blocky or non-blocky; for each classified blocky boundary, defining an adaptive, picture content-dependent, one-dimensional filtered pixels region of interest (ROI) having two ends and bound at each end by a bounding pixel, the ROI including a first plurality of concatenated, adjacent pixels to be filtered, the ROI crossing the blocky boundary; defining a finite filter with a length correlated with the first plurality of concatenated, adjacent pixels of the ROI; defining a filtering pixels expansion having a second one dimensional plurality of pixels, the second plurality including the first plurality of pixels; and filtering the first plurality of pixels using the finite filter and the filtering expansion.

According to one feature of the method of the present invention, the ROI is symmetric.

According to another feature of the method of the present invention, the ROI is asymmetric.

According to the present invention, in a preferred embodiment of the method the classifying includes classifying boundaries spaced apart from each other by 8 pixels.

According to a feature in the preferred embodiment of the method of the present invention, the classifying further includes assigning the value of each pixel of a boundary pixel-duo P₈ and P₉, the boundary pixel-duo included in the first pixel plurality and straddling the block boundary, choosing a multiplier M and a receiving a quantization scale parameter QS, and classifying the block boundary as blocky if |P₈−P₉|≦(M*QS).

According to another feature in the preferred embodiment of the method of the present invention, the definition of an adaptive one-dimensional filtered pixels ROI includes: for each blocky boundary, assigning four pixel values P₅, P₆, P₇, P₈ of adjacent pixels residing on a left side for a vertical boundary and on a top side for a horizontal boundary and four pixel values P₉, P₁₀, P₁₁, P₁₂ of adjacent pixels residing on a right side for a vertical boundary and on a bottom side for a horizontal boundary, providing a threshold Threshold_1, and running an iterative cycle comparing absolute value differences between each adjacent pixel pair on each side of the boundary and Threshold_1.

According to yet another feature in the preferred embodiment of the method of the present invention, the comparison of absolute value differences includes, iteratively: checking if |P_(X)−P_(X−1)|≦Threshold_1 wherein X is successively 8, 7 and 6 and, if true, including each P_(X−1 in) the filtered pixels ROI, the ROI bound with P₅ as a bounding pixel, else using P_(X) as the bounding pixel to bound the ROI on the left side for a vertical block boundary and on the top side for a horizontal block boundary; and checking if |P_(X)−P_(X+1)|≦Threshold_1 wherein X is successively 9, 10 and 11 and, if true, including each P_(X+1) in the filtered pixels ROI, the ROI bound with P₁₂ as a bounding pixel, else using P_(X) as a right bounding pixel for a vertical block boundary and as a bottom bounding pixel for a horizontal block boundary to bound the ROI on right side for a vertical boundary and on the bottom side for a horizontal boundary.

According to yet another feature in the preferred embodiment of the method of the present invention, the definition of a finite filter further includes: if the filtered pixels ROI includes 8 pixels P₅ to P₁₂, defining the filter as Filter_1 where Filter_1=[h₀, h₁, h₂, h₃, h₄, h₅, h₆, h₇, h₈], and if the filtered pixels ROI includes less then 8 pixels, defining the filter as Filter_2 where Filter_2=[h₀, h₁, h₂, h₃, h₄].

According to yet another feature in the preferred embodiment of the method of the present invention, the definition of a filtering pixel expansion includes: receiving as input the bounding pixel of the filtered pixels ROI, the bounding pixel value obtained in the checking, receiving as input a pixel adjacent to the bounding pixel, the adjacent pixel residing outside the filtered pixels ROI, providing a threshold Threshold_2, and calculating an absolute gray-level difference between the bounding pixel and the adjacent pixel, and comparing the absolute gray-level difference with Threshold_2.

According to yet another feature in the preferred embodiment of the method of the present invention, the comparison of the absolute gray-level difference with Threshold_2 further includes, for a vertical block boundary: checking if |P_(LB)−P_(LB−1)|≦Threshold_2 where P_(LB−1) is the pixel immediately adjacently to the left of P_(LB) and P_(LB) is the left bounding pixel, and if true using the value of P_(LB−1) for the expansion, else using the value of P_(LB) for the expansion, and checking if |P_(RB)−P_(RB+1)|≦Threshold_2, where P_(RB+1) is the pixel immediately adjacently to the right of P_(RB) and P_(RB) is the right bounding pixel, and if true, using the value of P_(RB+1) for the expansion, else using the value of P_(RB) for said expansion.

According to yet another feature in the preferred embodiment of the method of the present invention, the comparison of the absolute gray-level difference with Threshold_2 further includes, for a horizontal block boundary: checking if |P_(TB)−P_(TB−1)|≦Threshold_2 where P_(TB−1) is the pixel immediately adjacently above P_(TB) and P_(TB) is the top bounding pixel, and if true, using the value of P_(TB−1) for the expansion, else using the value of P_(TB) for the expansion, and checking if |P_(BB)−P_(BB+1)|≦Threshold_2, where P_(BB+1) is the pixel immediately adjacently below P_(BB) and P_(BB) is the bottom bounding pixel, and if true, using the value of P_(BB+1) for the expansion, else using the value of P_(BB) for the expansion.

According to yet another feature in the preferred embodiment of the method of the present invention, the filtering of the filtered pixels ROI using Filter_1 and the filtering pixels expansion includes: padding four values to each side of the one-dimensional filtered pixels ROI using the filtering pixels expansion values, and filtering the one-dimensional filtered pixels ROI using Filter_1.

According to yet another feature in the preferred embodiment of the method of the present invention, the filtering of the filtered pixels ROI using Filter_2 and the filtering pixels expansion includes: padding two values to each side of the one-dimensional filtered pixels ROI using the filtering pixels expansion values, and filtering the one-dimensional filtered pixels ROI using Filter_2.

BRIEF DESCRIPTION OF THE DRAWINGS

The invention is herein described, by way of example only, with reference to the accompanying drawings, wherein:

FIG. 1 illustrates the blocking artifact: A—an original picture, B—a reconstructed (encoded/decoded) picture;

FIG. 2 shows visualization of definitions: vertical block boundary, horizontal block boundary and boundary pixel-duo;

FIG. 3 shows a block diagram of the main conceptual stages of the suggested method for removing blocking artifacts;

FIG. 4 shows visualization of definitions: labeling of pixels of interest of the presented method over horizontal block boundaries and vertical block boundaries;

FIG. 5 shows a detailed flowchart of the conceptual stages of the suggested method for removing blocking artifacts;

FIG. 6 shows an example of the conceptual stages of the suggested method for removing blocking artifacts: A—part of a picture, B—illustration of classification stage, C—illustration of filtered pixels ROI stage, and D—illustration of filtered pixels expansion stage;

FIG. 7 shows examples for padding for a 9 taps filter: A—filtered pixels ROI with and without expansion, and B—filtered pixels ROI with expansion and padding;

FIG. 8 shows examples for padding for a 5 taps filter: A—filtered pixels ROI with and without expansion, and B—filtered pixels ROI with expansion and padding;

FIG. 9 shows examples of the performance of the suggested de-blocking method: A and C—pictures encoded at 40 KBPS/10 FPS: B and D—pictures after using the de-blocking method described herein;

DESCRIPTION OF THE PREFERRED EMBODIMENTS

The present invention is of a method for reducing blocking artifacts. In the following description, we will refer to 8×8 pixel blocks, with the understanding that the method described is equally applicable to any N×N block based compression. The method presented herein can remove blocking artifacts from pictures that were, for example, compressed using one of the compression methods mentioned above. The method presented herein can be performed on a reconstructed picture, used as a post-processing operation in order to improve and enhance picture quality, or used as an in-loop operation in order to enhance image quality and improve the process of estimating motion within the compression loop.

The principles and operation of a method for reducing blocking artifacts according to the present invention may be better understood with reference to the drawings and the accompanying description.

Referring now to the drawings, FIG. 2 shows some of the definitions used in the following description. FIG. 2 shows a picture area 100 formed of four blocks 102, 104, 106, and 108. Each of the four blocks shown includes 64 pixels. A horizontal block boundary 110 separates top blocks 102 and 104 from bottom blocks 106 and 108. A vertical block boundary 110 separates left blocks 102 and 108 from right blocks 104 and 106. A pair of pixels residing on opposite sides of a boundary e.g. pixel pairs 114 and 116 are defined a Boundary Pixel-Duo. The method is performed on all block boundaries of a block-decoded picture, preferably first over the horizontal boundaries (i.e. from top to bottom or from bottom to top in FIG. 2), and then on the vertical boundaries (i.e. from left to right or from right to left in FIG. 2). The most preferred sequence is to operate the method first over the horizontal boundaries from top to bottom, and then over the vertical boundaries from left to right. This since decoding is commonly performed in raster scan, and quantization over the horizontal block boundaries is more severe in the general case, hence it is desired to treat it first. However, in the most general case, the operation of the method of the present invention can be performed in any sequence involving the horizontal and vertical block boundaries.

In a preferred method embodiment, the removal of a blocking artifact includes four conceptual stages as shown in a block diagram in FIG. 3, and as described below. The four stages are:

Block Boundary Classification stage 150 is a stage performed for every pixel-duo that defines a block boundary (horizontal and vertical). This stage determines for every pixel-duo in the picture whether it resides across a Blocky boundary or a Non-Blocky boundary, thus providing the decision rule for this classification. Every pixel-duo residing across a boundary classified as Blocky goes on to be treated using the next three stages. Every pixel-duo residing across a Non-blocky boundary is passed over by the next three stages, i.e. these stages are not operative in this case.

Filtered Pixels Region of Interest and Filter Definition stage 152. In this stage the region of interest (ROI) that contains the pixels that will undergo filtering (in a filtering stage 156, see below) is defined. In addition this stage also provides the method and rule for choosing and defining the actual filter that will perform the filtering in stage 156. All the pixel values that belong to the filtered pixels ROI will change after filtering stage 156 is performed. The filtered pixels ROI is a concatenated set of pixels that cross a block boundary in one dimension. The definition or choice of the pixels that will become members of the filtered pixels ROI is unique, and it is done according to a certain rule, explained below. The definition is such that the ROI will contain a blocky boundary and a smooth set of pixels on each side of the block boundary, and will not include edges. Once the filtered pixels ROI is defined, a unique rule provides a method for choosing a filter to be used in filtering stage 156. ROI definition stage 152 is performed for every pixel-duo residing across a boundary classified as blocky in stage 150.

Filtering Pixels Expansion stage 154. It is a well know fact that when a finite length one-dimensional ROI of values, and a finite length one-dimensional filter of, say, length L (where L is an odd number, and the ((L−1)/2+1)^(th) filter tap is the middle filter tap) are given, and filtering is to be performed, the filtering of the (L−1)/2 leftmost (or top-most for the vertical case) values and the filtering of the (L−1)/2 rightmost (or bottom-most for the vertical case) values must be well defined. It is common to define “padding” of (L−1)/2 values to the left (or top) and right (or bottom) of the ROI of values. This stage in the present invention provides the technique for explicitly defining the values to be used for padding the left side (or top) and right (or bottom) side of the finite one-dimensional ROI of values that was defined in stage 152. The suggested technique for explicitly defining the values to be used for padding is defined in such a way that the outcome of the filtering stage 156 provides the best visual quality for a human observer.

Filtering stage 156 is the stage in which the actual filtering of the pixels in the filtered pixels ROI (stage 152) is performed. In the filtering stage, a one-dimensional Finite Impulse Response (FIR) Low Pass Filter (LPF) is introduced to the filtered pixels ROI. Filtering pixels expansion stage 154 is used to define the padding of the finite one-dimensional filtered pixels ROI so that the outcome of the filtering will be of high visual quality. The filter used for filtering is the filter previously defined in stage 152.

FIG. 4 shows a 16×16 pixel image section. A set of pixels labeled P₄, P₅, P₆, P₇, P₈, P₉, P₁₀, P₁₁, P₁₂ and P₁₃ form a one-dimensional pixel span (of interest regarding the present invention) that cross a block boundary. In FIG. 4, a horizontal pixel span 200 crosses a vertical block boundary 202, while a vertical pixel span 204 crosses a horizontal block boundary 206. The same numbering is used for the span of pixels over a horizontal block boundary and over a vertical block boundary.

FIG. 5 shows a detailed block diagram detailing the flow of the algorithm for removing blocking artifacts, which is built around the four stages 150, 152, 154, 156, of FIG. 3.

The algorithm starts with classification stage 150 using as an input 300 the pair (boundary pixel-duo) P₈ and P₉, and two additional parameters—the QS associated with the block containing P₉, and a parameter “M”. “M” is a gain, with values typically of the order of 2 to 5, which multiplies the QS parameter. The classification criteria used in the preferred embodiment is according to: |P₈−P₉|≦M*(QS). If the condition above is true, then the block boundary associated with the specific pixel-duo P₈ and P₉ is classified as Blocky, and if the condition above is false then the block boundary associated with the specific pixel-duo P₈ and P₉ is classified as Non-Blocky.

Multiplier “M” is defined in the classification condition since the QS alone is not sufficient for a definition whether a block boundary is blocky or non-blocky. The QS alone is a direct measure for the quantization error of the mean block value, and as such it may be used only as part of the measure of blockyness. The QS is not taking into consideration higher order data like DCT basis components and their phase. By using a multiplier of a constant value, a better classification may be achieved. As a rule, all the pixels that belong to the 8×8 block boundaries (vertical and horizontal) of a reconstructed picture undergo block boundary classification stage 150.

If a specific one-dimensional block boundary is classified as Non-Blocky, no filtering is performed across it (the observation in this case is that an edge is the cause for the discontinuity between the two adjacent pixels comprising the specific pixel-duo). If a block boundary is classified as Blocky, the algorithm proceeds to stage 152 (the observation in this case is that the discontinuity between two adjacent pixels comprising the specific pixel-duo is caused by a blocking artifact).

Referring to FIG. 4, filtered pixels ROI definition stage 152 considers the span of pixels P₅, P₆, P₇ and P₈ on the left of a vertical block boundary (202) or above a horizontal block boundary (206), and the span of pixels P₉, P₁₀, P₁₁ and P₁₂ on the right of a vertical block boundary (202) or below a horizontal block boundary (206). P₅, P₆, P₇, P₈, P₉, P₁₀, P₁₁ and P₁₂ are input at an input 302 in FIG. 5.

A detailed iterative procedure for the definition of the filtered pixels ROI is now given below.

The basic operation is measuring the absolute gray-level difference of two adjacent (neighboring) pixels against a pre-determined threshold (Threshold_1), input at a first threshold input 302. If the absolute gray-level difference of two adjacent pixels is smaller than or equal to Threshold_1, then those two adjacent pixels are considered similar (it is an observation of this invention that such two pixels form a concatenation of two pixels both belonging to a smooth area). If the absolute gray-level difference of two adjacent pixels is larger than Threshold_1, then those two adjacent pixels are considered not similar, hence implying the presence of an edge in the picture content. A typical range for Threshold_1 is between 2-6, with most preferable values being 3 and 4.

The first iteration starts with the check |P₈−P₇|≦Threshold_1. If true, P₇ is in the filtered pixels ROI, bounding (closing) it from the left in the case of a vertical boundary (e.g. boundary 202 in FIG. 4) and from the top in the case of a horizontal boundary (e.g. boundary 206 in FIG. 4). Else (i.e. if |P₈−P₇|>Threshold_1 the filtered pixels ROI is bound (closed) on the left for boundary 202, and from the top for boundary 206 by P₈. Within this text we will refer to any of the pixels P₈ down to P₅ that close the filtered pixels ROI from the left as a “left bounding ROI pixel” or “P_(LB)”. The discussion will continue with reference to “left to right” pixel ranges crossing a vertical boundary, with the understanding that the definition of a vertical filtered pixels ROI crossing a horizontal boundary is identical. Specifically, in FIG. 4, any of pixels P₈ down to P₅ in span 204 that close the filtered pixels ROI crossing boundary 206 from the top will be a “top bounding ROI pixel” or “P_(TB)”.

If the filtered pixels ROI was not closed by P₈ (that is if P₇ was the left bounding ROI pixel of the first iteration), a next iteration is run in which the check is |P₇−P₆|≦Threshold_1. If true, P₆ is in the filtered pixels ROI and is the P_(LB). Else, P₆ is not in the filtered pixels ROI, and hence P₇ is the P_(LB), and the process of defining the left boundary of the filtered pixels ROI stops.

If the filtered pixels ROI was not closed by P₇, then the next iteration checks if |P₆−P₅|≦Threshold_1. If true, P₅ is in the filtered pixels ROI, the process of defining the ROI from the left ends, and the filtered pixels ROI is closed from the left side by P₅ (P₅ is the P_(LB)). Else, P₅ is not in the filtered pixels ROI and P₆ is the P_(LB).

Next, a similar iterative procedure is run on the four pixels P₉-P₁₂ across the boundary. As above, and without any loss of generality, we will deal with a horizontal span crossing a vertical boundary, the aim of this part of the procedure being to find a “right bounding ROI pixel” or “P_(RB)”, equivalent to a “bottom bounding ROI pixel” or “P_(BB)” of a vertical span crossing a horizontal boundary. Starting in a first iteration with the check |P₉-P₁₀|≦Threshold_1. If true, then P₁₀ is in the filtered pixels ROI (and is the P_(RB)) and the process of defining the ROI continues. Else, P₁₀ is not in the filtered pixels ROI, the filtered pixels ROI is closed from the right side by P₉, which is the P_(RB), and the process of defining the ROI stops. Following a respective “continuation” decision, similar iterations are run with the checks |P₁₀-P₁₁|≦Threshold_1 and |P₁₁-P₁₂|≦Threshold_1.

It is important to note that there is no relation between the magnitude of the QS used in classification stage 150 and Threshold_1 used in stage 152. In stage 152, the internal block gray-level self-similarity of the pixels is of main interest. For example, there might be an area of smooth content (or even constant content) in which self-similarity of values inside the block exists, co-existing with a large discontinuity over a block boundary that was caused by a large value of quantization in the encoding process.

It is stated as part of this invention that the iterative procedure defined above can be generalized to work with any block size, and it is not limited to 8×8 pixel blocks. A generalization is done by iterating for N/2 steps the basic rule |P_(X)−P_(X−1)|≦Threshold_1, N being the size of the block, and “X” starting from the index associated with the pixels most adjacent to a block boundary. X stars from the left side for a vertical boundary, and from the top side for a horizontal boundary, in the left and top direction, A generalization is similarly done by iterating for N/2 steps the basic rule |P_(X)−P_(X+1)|≦Threshold_1, N being the size of the block, and “X” starting from the index associated with the pixels most adjacent to a block boundary from the right side for a vertical boundary and from the bottom side for a horizontal boundary, in the right and bottom direction. The description below continues with reference to the special case of 8×8 pixel blocks, with the understanding that the invention as described works with general N×N blocks as well.

Once the filtered pixels ROI is decided, the algorithm, in stage 152, proceeds to define the filter that will be used in the filtering stage (156). In the preferred embodiment, the filter is chosen according to the size of the filtered pixels ROI, as explained below. The filtered pixels ROI may include in the case of 8×8 blocks: 2, 3, 4, 5, 6, 7 or 8 pixels, in one of 16 different pixels compositions (for example: P₇, P₈, P₉ and P₈, P₉, P₁₀ form two compositions of 3 pixels, P₆, P₇, P₈, P₉ and P₇, P₈, P₉, P₁₀ and P₈, P₉, P₁₀, P₁₁ form three compositions of 4 pixels, and so on). The FIR filter is preferably chosen according to the following rule: if the length of the filtered pixels ROI is exactly 8 pixels, then the filter to be used in filtering stage 156 is a 9 Taps FIR filter labeled Filter_1, where Filter_1=[h₀, h₁, h₂, h₃, h₄, h₅, h₆, h₇, h₈], (h₄ being the center of the filter). Typical values for Filter_1 are Filter_1=[1 1 2 2 4 2 2 1 1]/16, however any low pass filter having the same nature will also be suitable. If the length of the filtered pixels ROI is less than 8 pixels, then the filter to be used in filtering stage 156 is a 5 Taps FIR filter labeled Filter_2, where Filter_2=[h₀, h₁, h₂, h₃, h₄], (h₂ being the center of the filter). Typical values for Filter_2 are Filter_2=[1 1 4 1 1]/8, however any low pass filter having the same nature will also be suitable.

It is an observation of this invention that if the filtered pixels ROI is 8 pixels long, then the 8 pixels of the filtered pixels ROI belong to a smooth area in the picture. In this case a long filter will provide better smoothing of the blocking artifact, hence a filter 9 Taps long is chosen in the preferred embodiment.

Once the filtered pixels ROI and the filter to be used in the filtering stage are decided, the algorithm proceeds to stage 154—the filtering pixels expansion stage. In this stage, the values to be used for padding the left (or top) side and right (or bottom) side of the finite horizontal (or vertical) one-dimensional ROI of values are determined.

The expansion value (i.e. the value to be used for padding in filtering stage 156) is preferably determined by measuring and comparing the absolute gray-level difference of two adjacent (neighboring) pixels, of which one is a filtered pixels ROI “bounding pixel” and the other an adjacent neighbor, against a pre-determined threshold (Threshold_2). Threshold_2 is input at a second threshold input 304, and is typically larger by an order of magnitude than Threshold 1. In the horizontal direction (for vertical block boundaries 202) stage 152 defined the left bounding ROI pixel (P_(LB)) and the right bounding ROI pixel (P_(RB)). The expansion to the left of P_(LB) is determined according to: |P_(LB)−P_(LB−1)|≦Threshold_2, where P_(LB−1) is the pixel to the left of P_(LB). If true, P_(LB−1) is the expansion pixel and the value of P_(LB−1) is used for padding in filtering stage 156. Else, P_(LB) is the expansion pixel and the value of P_(LB) is the value used for padding in filtering stage 156. The expansion to the right of P_(RB) is determined according to: |P_(RB)−P_(RB+1)|≦Threshold_2, where P_(RB+1) is the pixel to the right of P_(RB). If true, P_(RB+1) is the expansion pixel and the value of P_(RB+1) is used for padding in filtering stage 156. Else, P_(RB) is the expansion pixel and the value of P_(RB) is the value used for padding in filtering stage 156.

In the vertical direction (for horizontal block boundaries 206), the expansion value is determined in a similar fashion, but replacing P_(LB) and P_(RB) with, respectively, P_(TB) and P_(BB). The padding to the top of P_(TB) is determined according to: |P_(TB)−P_(TB−1)|≦Threshold_2, where P_(TB−1) is the pixel immediately above P_(TB). If true, P_(TB−1) is the expansion pixel and the value of P_(TB−1) is used for padding in filtering stage 156. Else, P_(TB) is the expansion pixel and the value of P_(TB) is the value used for padding in filtering stage 156. The padding to the bottom of P_(BB) is determined according to: |P_(BB)−P_(BB+1)|≦Threshold_2, where P_(BB+1) is the pixel immediately below P_(BB). If true, P_(BB+1) is the expansion pixel and the value of P_(BB+1) is used for padding in filtering stage 156. Else, P_(BB) is the expansion pixel and the value of P_(BB) is the value used for padding in filtering stage 156. For example if P₅ was found to be a P_(LB) in stage 152, expansion stage 154 will check the value of P₅ against the value of P₄ (in this case=P_(LB−)1), specifically |P₅−P₄|≦Threshold_2. If true, P₄ is the expansion (i.e. the padding value) that will be used for padding the finite filtered pixels ROI from the left side in filtering stage 156. Else, P₅ is the expansion (i.e. the padding value) that will be used for padding the finite filtered pixels ROI from the left side in filtering stage 156.

Referring now to FIG. 6, the three stages 150, 152, 154 are illustrated clearly via an example. FIG. 6A illustrates six blocks 220, 222, 224, 226, 228 and 230 of a picture 210, divided by a vertical boundary 232 and two horizontal boundaries 234 and 236. FIG. 6B illustrates classification stage 150 performed on picture 210. In B, pixels marked “X” illustrate several boundary pixel-duos (and according to FIG. 4 referred to as pixels P₈ and P₉) that were classified as Blocky across vertical block boundary 232 (i.e. P₈ and P₉ are classified as residing on each side of a blocky boundary). FIG. 6C illustrates the result of the filtered pixels ROI stage 152. For all the vertical boundaries classified as Blocky in FIG. 6B, a different filtered pixels ROI is determined according to the picture content. In FIG. 6C, eight different cases of filtered pixels ROI are presented: 250 (two symmetric sets of 8 pixels), 252 (one asymmetric set of 4 pixels to the left, i.e. P₈, P₇, P₆, P₅, and two to the right, i.e. P₉, P₁₀, of boundary 232, 254 (three asymmetric sets of 5 pixels, 4 to the left and 1 to the right of boundary 232), 256, 258, 260, 262 and 264. In 250, P₅ is the left bounding ROI pixel and P₁₂ is the right bounding ROI pixel, in 252, P₅ is the left bounding ROI pixel and P₁₀ is the right bounding ROI pixel, in 254, P₅ is the left bounding ROI pixel and P₉ is the right bounding ROI pixel. The latter five ROIs are not explained in detail, but clearly follow the explanations of the first three. All pixels marked “X” in FIG. 6C will be changed by filtering stage 156. Finally, FIG. 6D illustrates the outcome of the filtering pixels expansion stage (154) (in the figure only the expansion pixels that are not ROI bounding pixels are uniquely marked, for example pixels 270 and 272, for simpler visualization. Where not uniquely marked, the bounding pixel itself is used for padding).

The filtered pixels ROI process of stage 152 allows only similar gray-leveled pixels to join the filtered pixels ROI, hence an edge in the picture content will stop the growth of the filtered pixels ROI (which is the desired behavior in stage 152). In filtering stage 156, to which the algorithm proceeds next, a filtering process smoothes the filtered pixels ROI using a finite length low pass filter. If the edge that stopped the growth of the filtered pixels ROI is high, then the visual result after filtering is good. If the edge that stopped the growth of the filtered pixels ROI is mild (“mild” herein is considered to be more or less 25 to 45 gray-levels difference), the filtering pixels expansion stage is designed to allow mild edges to be used for padding (e.g. if Threshold_2 is chosen to be of the order of the mild edges gray-levels difference, i.e. between typically 25 and 45, and most preferably between 25 and 30). This way, mild edges are slightly smoothed by the algorithm, producing good visual quality.

The filtering procedure includes two steps: padding the finite length one-dimensional filtered pixels ROI using the expansion values, and filtering the finite length filtered pixels ROI with the filter.

The padding step has two possible scenarios, depending on the length of the filter (which is an outcome of stage 152). FIG. 7 and FIG. 8 depict the two scenarios for a vertical boundary case: FIG. 7 depicts the scenario in which the 9 taps filter is used, and FIG. 8 depicts the scenario in which the 5 taps filter is used.

In FIG. 7A, the filtered pixels ROI is P₅ to P₁₂, hence the 9 Taps filter (Filter_1) is used. The left side of the filtered pixels ROI was expanded by pixel P₄ (identically P_(LB−1)), so the padding in FIG. 7B is done by adding four pixels of value P₄ to the left of the filtered pixels ROI (filtering will start at P₅ since P₅ is the first pixel in the filtered pixels ROI. P₄ contributes to the filtering but it is not altered by it). The right side of the ROI was expanded by pixel P₁₂ (identically P_(RB)), in which case the padding in FIG. 7B is done by adding four pixels of value P₁₂ to the right of the filtered pixels ROI.

In FIG. 8A, the filtered pixels ROI is P₇ to P₁₂, hence the 5 Taps filter (Filter_2) is used. The left side of the filtered pixels ROI was expanded by pixel P₆ (identically P_(LB−1)), so the padding in FIG. 7B is done by adding two pixels of value P₆ to the left of the filtered pixels ROI (filtering will start at P₇ since P₇ is the first pixel in the filtered pixels ROI. P₆ contributes to the filtering but it is not altered by it). The right side of the filtered pixels ROI was expanded by pixel P₁₂ (identically P_(RB)), in which case the padding in FIG. 8B is done by adding two pixels of value P₁₂ to the right of the filtered pixels ROI.

The filtering process is simply a finite length one-dimensional filtering between the finite length filter and the finite length padded filtered pixels ROI, and the result is taken only for the pixels that are the members of the filtered pixels ROI.

Finally, referring to FIG. 9 that shows an example of the performance of the suggested method for removing blocking artifacts, FIG. 9A and FIG. 9C present pictures encoded at a bit rate of 40 Kbps and a frame rate of 10 fps, in which the blocking artifact is visible. FIG. 9B and FIG. 9D present respectively the outcome of the suggested de-blocking method for the two compressed pictures.

In summary, a major innovative aspect of the method of the present invention includes the adaptive choice of filtered pixels ROI—we choose the entire population of pixels that can be smoothed without causing artifacts (like smoothing out an edge). The method works well with any number of edges in the processed picture content. Another innovative aspect is the way bounding conditions for finite length filtering are treated, as a result of the method's ability to distinguish between high and mild edges. In addition, more aggressive filtering is introduced for areas defined as smooth. As a result the quality and sharpness of the picture are not reduced by applying this method to blocky pictures.

Other advantages of the present method include:

-   -   a) making a distinct separation between strong edges and mild         edges,     -   b) never missing a block boundary (edge in the block or not),     -   c) not smoothing out an edge into the data, and     -   d) exploiting the full width of the smooth region.

All publications, patents and patent applications mentioned in this specification are herein incorporated in their entirety by reference into the specification, to the same extent as if each individual publication, patent or patent application was specifically and individually indicated to be incorporated herein by reference. In addition, citation or identification of any reference in this application shall not be construed as an admission that such reference is available as prior art to the present invention.

While the invention has been described with respect to a limited number of embodiments, it will be appreciated that many variations, modifications and other applications of the invention may be made. 

1. A method for removing blocking artifacts from moving and still pictures, each picture composed of blocks defined by horizontal and vertical block boundaries, the method comprising the steps of: a. in each picture, classifying the horizontal and vertical boundaries as having a difference in pixel values across the boundaries as being more or not more than a predetermined level; b. for each said classified boundary having a difference in pixel values across the boundaries as being not more than said predetermined level, defining a one-dimensional filtered pixels region of interest (ROI) with an adaptive, picture content-dependent spatial extent, having two ends and bounded at each said end by a bounding pixel, said ROI including a first plurality of concatenated, adjacent pixels to be filtered, said ROI crossing said boundary having a difference in pixel values across the boundaries as being not more than said predetermined level, and wherein defining the adaptive, picture content-dependent spatial extent of the ROI comprises iteratively checking pixels on each side of the block boundary to determine whether the pixel is to be included in the ROI until each end of the ROI is closed by its bounding pixel; c. defining a finite filter with a length correlated with said first plurality of concatenated, adjacent pixels of said ROI; d. defining a filtering pixels expansion having a second one dimensional plurality of pixels, said second plurality including said first plurality of pixels; and e. filtering said first plurality of pixels using said finite filter and said filtering pixels expansion.
 2. The method of claim 1, wherein said ROI is symmetric.
 3. The method of claim 1, wherein said ROI is asymmetric.
 4. The method of claim 1, wherein said classifying includes classifying boundaries spaced apart from each other by 8 pixels.
 5. The method of claim 4, wherein said classifying further includes: a. assigning the value of each pixel of a boundary pixel-duo P₈ and P₉, said boundary pixel-duo included in said first pixel plurality and straddling said block boundary, b. choosing a multiplier M and receiving a quantization scale parameter QS, and c. classifying said block boundary as having a difference in pixel values across the boundaries as being not more than said predetermined level if |P₈−P₉|≦(M*QS).
 6. The method of claim 4, wherein said definition of an adaptive one-dimensional filtered pixels ROI includes: a. for each said boundary having a difference in pixel values across the boundaries as being not more than said predetermined level, assigning four pixel values P₅, P₆, P₇, P₈ of adjacent pixels residing on a left side for a vertical block boundary and on a top side for a horizontal block boundary, and four pixel values P₉, P₁₀, P₁₁, P₁₂ of adjacent pixels residing on a right side for a vertical block boundary and on a bottom side for a horizontal block boundary, b. providing a threshold, Threshold_1, and, iteratively, c. comparing absolute value differences between each said adjacent pixel pair on each side of said boundary having a difference in pixel values across the boundaries as being not more than said predetermined level and said Threshold_1.
 7. A method for removing blocking artifacts from moving and still pictures, each picture composed of blocks defined by horizontal and vertical block boundaries, the method comprising the steps of: a. in each picture, classifying the horizontal and vertical boundaries as blocky or non-blocky, wherein said classifying includes classifying boundaries spaced apart from each other by 8 pixels; b. for each said classified blocky boundary, defining an adaptive, picture content-dependent, one-dimensional filtered pixels region of interest (ROI) having two ends and bounded at each said end by a bounding pixel, said ROI including a first plurality of concatenated, adjacent pixels to be filtered, said ROI crossing said blocky boundary; c. defining a finite filter with a length correlated with said first plurality of concatenated, adjacent pixels of said ROI; d. defining a filtering pixels expansion having a second one dimensional plurality of pixels, said second plurality including said first plurality of pixels; and e. filtering said first plurality of pixels using said finite filter and said filtering pixels expansion, wherein said definition of an adaptive one-dimensional filtered pixels ROI includes: i. for each said blocky boundary, assigning four pixel values P₅, P₆, P₇, P₈ of adjacent pixels residing on a left side for a vertical block boundary and on a top side for a horizontal block boundary, and four pixel values P₉, P₁₀, P₁₁, P₁₂ of adjacent pixels residing on a right side for a vertical block boundary and on a bottom side for a horizontal block boundary, ii. providing a threshold, Threshold_1, and, iteratively, iii. comparing absolute value differences between each said adjacent pixel pair on each side of said blocky boundary and said Threshold_1, wherein said comparison of absolute value differences includes, iteratively:
 1. checking if |P_(X)−P_(X−1)|≦Threshold_1 wherein X is successively 8, 7 and 6 and, if true, including each said P_(X−1), in said filtered pixels ROI, said ROI bound with said P5 as said bounding pixel on said left side for a vertical block boundary and on said top side for a horizontal block boundary, else
 2. using said P_(X) as said bounding pixel to bound said ROI on said left side for a vertical block boundary and on said top side for a horizontal block boundary, and
 3. checking if |P_(X)−P_(X+1)|≦Threshold_1 wherein X is successively 9, 10 and 11 and, if true, including each said P_(X−1) in said filtered pixels ROI, said ROI bound with said P₁₂ as said bounding pixel on said right side for a vertical block boundary and on said bottom side for a horizontal block boundary, else
 4. using said P_(x) as said bounding pixel to bound said ROI on said right side for a vertical block boundary and on said bottom side for a horizontal block boundary.
 8. The method of claim 4, wherein said definition of a finite filter further includes: a. if said filtered pixels ROI includes 8 pixels P5 to P12, defining said filter as Filter_1 where Filter_1 =[h₀, h₁, h₂, h₃, h₄, h₅, h₆, h₇, h₈], and b. if said filtered pixels ROI includes less then 8 pixels, defining said filter as Filter_2 where Filter_2 =[h₀, h₁, h₂, h₃, h₄].
 9. The method of claim 7, wherein said defining a filtering pixel expansion includes: a. receiving as input said bounding pixel of said filtered pixels ROI, said bounding pixel value obtained in said checking, b. receiving as input a pixel adjacent to said bounding pixel, said adjacent pixel residing outside said filtered pixels ROI, c. providing a threshold Threshold_2, and d. calculating an absolute gray-level difference between said bounding pixel and said adjacent pixel, and comparing said absolute gray-level difference with said Threshold_2.
 10. The method of claim 9, wherein said comparing said absolute gray-level difference with said Threshold_2 further includes, for a vertical block boundary: a. checking if |P_(LB)−P_(LB)|≦Threshold_2 where P_(LB−1) is the pixel immediately adjacently to the left of P_(LB) and P_(LB) is said left bounding pixel, and if true using the value of said P_(LB−1) for said expansion, else b. using the value of said PLB for said expansion, and c. checking if |P_(RB)—P_(RB+1)|≦Threshold_2 where P_(RB+1) is the pixel immediately adjacently to the right of P_(RB) and P_(RB) is said right bounding pixel, and if true, using the vaiuc of said P_(RB+1) for said expansion, else d. using the value of said P_(RB) for said expansion.
 11. The method of claim 9, wherein said comparing said absolute gray-level difference with said Threshold_2 further includes, for a horizontal block boundary: a. checking if |P_(TB)−P_(TB−1)|≦Threshold_2 where P_(TB−1) is the pixel immediately adjacently above P_(TB) and P_(TB) is said top bounding pixel, and if true, using the value of said P_(TB−1) for said expansion, else b. using the value of said P_(TB)for said expansion, and c. checking if |P_(BB)−_(BB+1)|Threshold_2 where PBB1 is the pixel immediately adjacently below P_(BB) and P_(BB) is said bottom bounding pixel, and if true, using the value of said P_(BB+1) for said expansion, else d. using the value of said PBB for said expansion.
 12. The method of claim 8, wherein said filtering of said filtered pixels ROI using said Filter_1 and said filtering pixels expansion includes: a. padding four values to each side of said one-dimensional filtered pixels ROI using the filtering pixels expansion values, and b. filtering said one-dimensional filtered pixels ROI using said Filter_1.
 13. The method of claim 8, wherein said filtering of said filtered pixels ROI using said Filter_2 and said filtering pixels expansion includes: c. padding two values to each side of said one-dimensional filtered pixels ROI using said filtering pixels expansion values, and d. filtering said one-dimensional filtered pixels ROI using said Filter_2.
 14. A method for removing blocking artifacts from a picture, determining whether the difference in pixel values across a block boundary of a block decoded picture is not more than a predetermined level; in response to determining that the difference in pixel values across the block boundary is not more than said predetermined level, determining, based on the content of the picture, the extent of a one-dimensional smooth set of pixels extending one or more pixels on each side of the boundary to filter, wherein determining the extent comprises iteratively checking pixels on each side of the block boundary to determine whether the pixel is to be included in the extent; and determining, based on the extent of the set of pixels, a filter with length correlated with said extent with which to filter the pixels of the set.
 15. The method of claim 14, wherein said determining that the difference in pixel values across the block boundary is not more than said predetermined level includes: comparing the pixel values of the pixel duo of adjacent pixels that define the block boundary.
 16. The method of claim 15, wherein said comparing the pixel values of the pixel duo of adjacent pixels that define the block boundary comprises determining whether the difference in amplitude of the pixels of the pixel duo is less than or equal to a constant times the quantization scale parameter.
 17. The method of claim 14, wherein said determining the extent of a one-dimensional smooth set of pixels includes: determining whether the set of pixels extends for one, two, thee, or four contiguous pixels on one side of the boundary and independently determining whether the set of pixels extends for one, two, three, or four contiguous pixels on the other side of the boundary.
 18. The method of claim 17, wherein said determining the extent of a one-dimensional smooth set of pixels includes using a grey scale comparison of adjacent pixels.
 19. The method of claim 14, wherein said determining the filter with which to filter the pixels of the set includes selecting a nine tap filter if the set of pixels extends for four pixels on each side of the block boundary.
 20. The method of claim 14, wherein said determining the filter with which to filter the pixels of the set includes selecting a five tap filter if the set of pixels extends for less than four pixels on either side of the block boundary.
 21. The method of claim 14, further comprising: filtering the pixels of the set using the filter, wherein padding values are used for filter taps extending beyond the set.
 22. The method of claim 21, further comprising: determining said padding values, wherein, for either side of the set, the padding values are determined by comparing the values of a first pixel and a second pixel, where the first pixel is the pixel adjacent to, but outside of, the set of pixels and the second pixel is the pixel inside the set that is adjacent to the first pixel.
 23. The method of claim 22, wherein, for either side of the set, the padding values are one of the values of said first pixel or said second pixel.
 24. The method of claim 14, wherein the boundary is vertical.
 25. The method of claim 14, wherein the boundary is horizontal.
 26. The method of claim 14, wherein the picture is a moving picture.
 27. The method of claim 14, wherein the picture is a still picture.
 28. The method of claim 14, wherein the method is used in a post-processing operation.
 29. The method of claim 14, wherein the method is performed on a reconstructed picture.
 30. The method of claim 14, wherein the method is used as an in-loop process.
 31. The method of claim 14, wherein the method is used for image enhancement.
 32. The method of claim 14, wherein the method is used for motion estimation.
 33. The method of claim 15, wherein said comparing the pixel values of the pixel duo of adjacent pixels that define the block boundary includes determining whether the difference in values of pixel duo is less than or equal to a value dependent on a quantization scale parameter. 